package com.clei.dto.geo;

/**
 * 边界框
 *
 * @author Y
 * @date 2023-09-22
 **/
public class BoundingBox {
    /**
     * 最小经度
     */
    private final double minLon;
    /**
     * 最大经度
     */
    private final double maxLon;
    /**
     * 最小纬度
     */
    private final double minLat;
    /**
     * 最大纬度
     */
    private final double maxLat;

    public BoundingBox(Point upperLeft, Point lowerRight) {
        this.minLon = upperLeft.getLongitude();
        this.minLat = lowerRight.getLatitude();
        this.maxLon = lowerRight.getLongitude();
        this.maxLat = upperLeft.getLongitude();
    }

    public BoundingBox(double minLon, double minLat, double maxLon, double maxLat) {
        this.minLon = minLon;
        this.minLat = minLat;
        this.maxLon = maxLon;
        this.maxLat = maxLat;
    }

    @Override
    public String toString() {
        return "BoundingBox{" +
                "minLon=" + minLon +
                ", maxLon=" + maxLon +
                ", minLat=" + minLat +
                ", maxLat=" + maxLat +
                '}';
    }

    public double getMinLon() {
        return minLon;
    }

    public double getMaxLon() {
        return maxLon;
    }

    public double getMinLat() {
        return minLat;
    }

    public double getMaxLat() {
        return maxLat;
    }
}
